#include <iostream>
#include <stdio.h>


using namespace std;

int a[12],b[12],c[12],d[12];
int ans= 0,i;
int n;

int dfs(int step){
    if(step==n+1){
        ans++;
        return 0;
    }
    for(int j = 1; j <= n; j++){
        if(b[j] == 0&&c[i+j] == 0&d[i-j+n] == 0){
            b[j] = 1;
            c[i+j] =1;
            d[i-j+n] = 1;
            dfs(step+1);
            b[j] = 0;
            c[i+j] = 0;
            d[i-j+n] = 0;
        }
    }
}

int main() {
    cin >> n;
    i = 5;
    dfs(1);
    cout << ans;
    return 0;
}